]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Resize the user's avatar when scaling factor changes
authorMario Sanchez Prada <mario@endlessm.com>
Thu, 10 Aug 2017 15:21:50 +0000 (16:21 +0100)
committerMario Sanchez Prada <mario@endlessm.com>
Fri, 11 Aug 2017 10:47:45 +0000 (12:47 +0200)
We need to consider the scaling factor in effect when updating the user's
avatar, and also make sure to update it as well whenever the scaling
factor changes.

https://bugzilla.gnome.org/show_bug.cgi?id=786120

js/ui/userWidget.js

index 966439f2ccdaa9492032ce826ced00c62cb07317..5c56fe4ed1d394ec8d07092a2a9dbac120551540 100644 (file)
@@ -35,6 +35,10 @@ var Avatar = new Lang.Class({
                                   reactive: params.reactive,
                                   width: this._iconSize * scaleFactor,
                                   height: this._iconSize * scaleFactor });
+
+        // Monitor the scaling factor to make sure we recreate the avatar when needed.
+        let themeContext = St.ThemeContext.get_for_stage(global.stage);
+        themeContext.connect('notify::scale-factor', Lang.bind(this, this.update));
     },
 
     setSensitive: function(sensitive) {
@@ -56,6 +60,9 @@ var Avatar = new Lang.Class({
             this.actor.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
                                              icon_size: this._iconSize });
         }
+
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+        this.actor.set_size(this._iconSize * scaleFactor, this._iconSize * scaleFactor);
     }
 });